#!/bin/bash

# CURRENT_DIR=$(realpath $(dirname "$0"))
# CONFIGS_DIR=$CURRENT_DIR/../config
CONFIGS_DIR=$ZMICRO_HOME/config

# Load Base Config
. $CONFIGS_DIR/config
# Load Doreamon Fns
. $ZMICRO_CORE_PATH/load

help() {
  echo "Usage:"
  echo "  zmicro config get <key>"
}

core() {
  if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
    help
    exit 0
  fi

  local key=$1
  if [ "$key" = "" ]; then
    log::error "key is required"
    
    help
    exit 1
  fi

  config::get $key
}

run() {
  core $@
}

run $@
